import config from "@/config"
import http from "@/utils/request"



export default {
  // 部门---------
  getDepartmentList: {
    url: `${config.API_URL}/department/list`,
    name: "获取部门列表",
    get: function (data) {
      return new Promise((resolve, reject) => {
        http.get(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  addDepartment: {
    url: `${config.API_URL}/department/add`,
    name: "添加部门",
    post: function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  updateDepartment: {
    url: `${config.API_URL}/department/update`,
    name: "更新部门",
    put: function (data) {
      return new Promise((resolve, reject) => {
        http.put(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },

  deleteDepartment: {
    url: `${config.API_URL}/department/delete`,
    name: "删除部门",
    delete: function (data) {
      return new Promise((resolve, reject) => {
        http.delete(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },
  deleteDepartmentList: {
    url: `${config.API_URL}/department/deleteList`,
    name: "批量删除部门",
    post: function (data) {
      return new Promise((resolve, reject) => {
        http.post(this.url, data).then((response) => {
          resolve(response)
        }).catch((error) => {
          resolve(error.data)
        })
      })
    }
  },



}
